package gw.com.android.ui.onlive;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author jett
 * @since 2018-03-08.
 */
public class TradeResultData implements Parcelable {

    public boolean profit;
    public String amount;
    public String product;
    public String quantity;
    public int tradeDir;
    public String openPrice;
    public String closePrice;
    public String openTime;
    public String closeTime;

    public TradeResultData() {
    }

    protected TradeResultData(Parcel in) {
        profit = in.readByte() != 0;
        amount = in.readString();
        product = in.readString();
        quantity = in.readString();
        tradeDir = in.readInt();
        openPrice = in.readString();
        closePrice = in.readString();
        openTime = in.readString();
        closeTime = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (profit ? 1 : 0));
        dest.writeString(amount);
        dest.writeString(product);
        dest.writeString(quantity);
        dest.writeInt(tradeDir);
        dest.writeString(openPrice);
        dest.writeString(closePrice);
        dest.writeString(openTime);
        dest.writeString(closeTime);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<TradeResultData> CREATOR = new Creator<TradeResultData>() {
        @Override
        public TradeResultData createFromParcel(Parcel in) {
            return new TradeResultData(in);
        }

        @Override
        public TradeResultData[] newArray(int size) {
            return new TradeResultData[size];
        }
    };
}
